package com.wenhuitec.productlib.ui.view;

import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.widget.LinearLayout;

import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.gzwh.weblib.bean.NzProductAttrModel;
import com.wenhuitec.productlib.R;
import com.wenhuitec.productlib.entity.Sku;
import com.wenhuitec.productlib.ui.adapter.attr.AttrPickAdapter;
import com.wenhuitec.productlib.ui.adapter.sku.ShowSkuAdapter;

import java.util.ArrayList;
import java.util.List;

public class ShowSkuView extends LinearLayout {

    private RecyclerView skuRv;
    private Context mContext;

    private ShowSkuAdapter showSkuAdapter;

    public ShowSkuView(Context context, AttributeSet attrs) {
        super(context, attrs);
        mContext = context;
        LayoutInflater.from(context).inflate(R.layout.view_show_sku, this, true);
        showSkuAdapter = new ShowSkuAdapter(mContext, new ArrayList<>());
        skuRv = findViewById(R.id.skuRv);
    }

    public void setList(List<Sku> skuList) {
        LinearLayoutManager layoutManager = new LinearLayoutManager(mContext);
        layoutManager.setOrientation(RecyclerView.VERTICAL);
        skuRv.setLayoutManager(layoutManager);
        skuRv.setAdapter(showSkuAdapter);
        showSkuAdapter.setList(skuList);
    }


}
